//
//  FileManage.m
//  Surprise
//
//  Created by dllo on 15/10/28.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "FileManage.h"

@implementation FileManage
#pragma mark 写人文件的类方法
+(void)writeFile:(NSDictionary *)dictionary andFilePath:(NSString *)dicPath{
    [dictionary writeToFile:dicPath atomically:YES];
}
#pragma mark 创建文件的类方法
+(NSString *)createFile:(NSString *)fileName{
    //沙盒机制
    NSString *cachesPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *Caches = [cachesPath stringByAppendingPathComponent:@"CachesFile"];
    [fileManager createDirectoryAtPath:Caches withIntermediateDirectories:YES attributes:nil error:nil];
    NSString *dicPath = [Caches stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", fileName]];
    return dicPath;
}
#pragma mark 读取文件
+(NSDictionary *)readFile:(NSString *)filePath{
    NSDictionary *dics = [NSDictionary dictionaryWithContentsOfFile:filePath];
    return dics;
}
@end
